﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using System.Text;

namespace Marmat.Common.Http
{

    /// <summary>
    /// Api请求时的上下文参数
    /// </summary>
    public class ApiActionContext : IDisposable
    {

        internal ApiActionContext(HttpApiConfig httpApiConfig, ApiActionDescriptor apiActionDescriptor)
        {
            this.HttpApiConfig = httpApiConfig;
            this.ActionDescriptor = apiActionDescriptor;
        }

        /// <summary>
        /// 获取此次请求的配置信息。
        /// </summary>
        public HttpApiConfig HttpApiConfig { get; }

        /// <summary>
        /// 获取此次请求的函数描述信息。
        /// </summary>
        public ApiActionDescriptor ActionDescriptor { get; }

        /// <summary>
        /// 获取即将发送的请求体。
        /// </summary>
        public HttpWebRequest Request { get; internal set; }

        /// <summary>
        /// 获取返回的请求体。
        /// </summary>
        public HttpWebResponse Response { get; internal set; }

        /// <summary>
        /// 设置或读取API请求的返回值。
        /// </summary>
        public object ReturnValue { get; set; }

        /// <summary>
        /// 释放使用的资源
        /// </summary>
        public void Dispose()
        {
        }
    }
}
